<?php
use yii\helpers\Url;
// $data_matrix = "https://proxcrm.xgate.com/barcode/frontend/web/index.php?r=qr/barcode&code=" . $userInfo['card_number'] . "&type=barcode";
// echo $barcode;exit;
$this->title = 'J SELECT 会员中心';
$signPackage = \app\components\Jssdk::getSignPackage();
?>
<style>
    .weui_cells_checkbox .weui_check:checked+.weui_icon_checked:before{
        font-size: 15px;
        color:#c9c9c9
    }
    .weui_cells_checkbox .weui_icon_checked:before {
        font-size: 15px;
    }
</style>
<script>
var signPackage = <?= json_encode($signPackage) ?>;
var positioningUrl = "<?=Url::to(['member/positioning'])?>";
    console.log(signPackage);
var timestamp = "<?= $sign['timestamp']?>"  
var nonce_str = "<?= $sign['nonce_str']?>"    
var signature = "<?= $sign['signature']?>"    

</script>
<div class="topContainer" style="width:95%;height:90%;max-width: 37.5rem">
    <div class="weui-flex" style="height:100%">
        <div class="weui-flex-item weui-flex" id="card" style="flex-direction:column">
            <div class="center tcenter" style="width:80%">
                <img src="https://imgsrv1.mailer08.net/images/dGVuYW50Mjg3YWRtaW4_/WTJGdGNHRnBaMjVmTWpJPQ/jselectLogo.png" alt="">
            </div>
            
            <!--领取原生会员卡到卡包 -->
            <div class="getCard weui-flex-item tcenter">
                <div class="f18">欢迎成为JSELECT新会员</div>
                <h3 class="f20 f-j"><b>独享专属好礼</b></h3>
                <button class="weui_btn weui_btn_mini bg-blue f16" style="padding:.5rem 3rem" id="getMemberCard" onclick="addVoucher()">点击领取会员卡</button>
                <div class="weui_cells weui_cells_checkbox" style="padding:.5rem 0">
                    <div class="weui_cell weui_check_label" for="tnc" style="margin:0;justify-content:center">
                        <label class="weui_cell_hd" id="tncLabel">
                            <input type="checkbox" class="weui_check" name="checkbox1" id="tnc" checked="checked">
                            <i class="weui_icon_checked"></i>
                        </label>
                        <div class="f11" >
                            <div style="font-weight:initial">我已阅读并同意<u class="f-j js-propShow">J SELECT使用条款</u>和<u class="f-j js-propShow">隐私政策</u>的全部内容</div>
                        </div>
                    </div>
                </div>
			</div>
            <div class="qrcode">
                <!-- <img src="<?= Url::to('@web/jebsen/img/qrCode2.png' ,true)?>" alt=""> -->
            </div>
        </div>
    </div>
</div>
<div class="weui_mask"></div>
<div class="weui-custom-pop">
    <div class="close js-close" >
        <i class="icon icon-95 f25"></i>
    </div>
    <div class="weui-custom-hd f16">
        条款及细则: 
    </div>
    <div class="weui-custom-bd">
        <ul class="tleft page-bd-15" style="list-style:none">
            <li>1.每位会员仅可获赠会员专属好礼一次。</li>
            <li>2.会员专属好礼数量有限，先到先得，送完即止。 </li>
            <li>3.会员专属好礼不可转让、退换或兑换现金。</li>
            <li>4.会员专属好礼不适用于现有的J SELECT会员。</li>
            <li>5.本优惠仅适用于J SELECT中国大陆代理消费品业务。</li>
            <li>6.捷成消费品有限公司保留随时修改本条款及细则、更改或终止优惠之权利，而不会作另行通知。 </li>
            <li>7.如有任何争议，捷成消费品公司保留最终决定权。</li>
        </ul>
    </div>
    <div class="weui-custom-ft">
        <a class="js-propHide f-black">不同意</a>
        <a class="js-redeemConfirm f-black">确定</a>
    </div>
</div>
<div id="resText"></div>
</body>
<?php

// $this->registerJsFile('//res.wx.qq.com/open/js/jweixin-1.2.0.js', ['depends' => [\app\assets\HxkjAsset::className()]]);
$this->registerJsFile('@web/jselect/js/wxjs.js', ['depends' => [\app\assets\HxkjAsset::className()]]);

$this->registerJsFile(Url::to('@web/jselect/js/jssdk.js?t='.time(), true), ['depends' => [\app\assets\HxkjAsset::className()]]);

?>
</html>

<?php 
    $js = '
        $(".qrcode").click(function() {
            $("#barCard").fadeIn();
        })
        $("#card").click(function() {
            $("#barCard").fadeIn();
        })
        $(".js-propShow").click(function (e) {
            e.stopPropagation()
            showmark()
        })
        $(".js-propHide").click(function () {
            hidemark()
            $("#tnc").prop("checked",false)
            $("#getMemberCard").attr("disabled",true)
        })
        $(".js-close").click(function () {
            hidemark()
        })
        $(".js-redeemConfirm").click(function () {
            hidemark()
            $("#tnc").prop("checked",true)
            $("#getMemberCard").attr("disabled",false)
        })
        $("#tncLabel").click(function () {
            $("#tnc").prop("checked")?$("#getMemberCard").attr("disabled",false):$("#getMemberCard").attr("disabled",true)
        })

        function showmark() {
            $(".weui_mask").addClass("weui_mask_visible");
            $(".weui-custom-pop").addClass("weui-dialog-visible");
        }
        function hidemark() {
            $(".weui_mask").removeClass("weui_mask_visible");
            $(".weui-custom-pop").removeClass("weui-dialog-visible");
        }
    ';
    $this->registerJs($js, \yii\web\View::POS_END);
?>
<script>
	
</script>